

def starts_with():
    s1 = 'hello'
    print(s1.startswith('h'))
    print(s1.startswith('h2'))
    print(s1.endswith('0'))
    print(s1.endswith('o'))
    print(s1.isalpha()) # 判断是否是字母
    print(s1.isdigit()) # 判断是否是数字
    print(s1.isalnum()) # 判断是否是字母数字
    print(s1.isspace()) # 判断是否是空格

def circulation():

    n = 0
    sum1 = 0
    while n <5:
        sum1 += n
        n +=1

    print(sum1)


def c2():
    n1 = 1
    s1 = 0
    while n1 < 10:
        s1 += n1
        n1 = n1 +1
        if n1 > 5:
            break
    print(s1)

def  data_transform():
    s1 = '123'
    print(type(eval(s1)))

    print(type(int(s1)))

    s2 = 'aa,bb,c,d'
    print(set(s2))
    l1 = '1,2,3,4a,bb'

    print(list(l1))
    l2 = l1.split(',')
    l3 = []
    l4 = []
    l5 = []
    for i in l2:
        if i.isdigit():
           l3.append(i)
        elif i.isalpha():
           l4.append(i)
        elif i.isalnum():
            l5.append(i)
    print(l3)
    print(l4)
    print(l5)
    # print(l1.split(','))

    n1 = '1,2,3,4a,bb'
    n2 = list(n1)
    n3 = []
    n4 = []
    for i in n1:
        if i.isdigit():
            n3.append(i)
        else:
            n4.append(i)
    print(n3)
    print(n4 )

def data_transform2():
    s1 = '1,2,3'
    s2 = '123'
    s3 = '[1,2,3]'
    s4 = '(1,2,3)'
    s51 = '{1:2,2:3}'
    s5 = 'False'
    s6 = '1.2'
    s7 = 'asd'
    s8 = '{1,2,3}'
    print(type(eval(s2)))
    print(type(eval(s3)))
    print(type(eval(s4)))
    print(type(eval(s51)))
    print(type(eval(s5)))
    print(type(eval(s6)))
    # print(type(eval(s7)))
    print(type(eval(s8)))

def printf():
    age = 18
    name = '张三'
    weight = 80.88
    student_id =  1
    print('我的名字是%s' %name)
    print('我的学号是：%d' %student_id)
    print('我的体重是%.2f公斤' %weight)

    print('my name is %s, I age is %d' %(name ,age+1))
     # f表达式
    print(f'my name is {name},I age is {age}, I weight is {weight:.3f}')

    # 转义字符
    print('反斜杠换行\n 第二行')
    print('反斜杠换行\\n 取消换行')
    print('hello world',end = ' hhh\n')

    print('123',end='--->')
    print('456')

import random

# 0 rock 石头, 1 paper 剪刀, 2 scissors 布
def rock_paper_scissors():
    while True:

        n = random.randint(0,2)
        user = int(input('please input number:'))
        if user == n:
            print('平局')
        elif user == 0 and n == 1:
            print('you win')
        elif user == 0 and n == 2:
            print('you loser')

        elif user == 1 and n == 0:
            print('you loser')
        elif user == 1 and n ==2:
            print('you win')
        elif  user == 2 and n == 0:
            print('you win')
        elif user  == 2 and user ==1:
            print('you loser')








if __name__ == '__main__':
    # starts_with()
    # circulation()
    # c2()
    # # data_transform()
    # data_transform2()
    # printf()

    rock_paper_scissors()
    c = random.randint(0,2)
    print(c)